--
-- Author: mm
-- Date: 2019-06-05 15:09:34
--
-- SuperrankController
--

local SuperRankView = import("..views.SuperRankView")
local SuperRankController = class("SuperRankController", app.mvc.ControllerBase)


function SuperRankController:ctor(data)
    self.super.ctor(self, data)
end

function SuperRankController:init()
    
end

function SuperRankController:removeListeners()
    self.super.removeListeners(self)
end

function SuperRankController:onEvent(eventName, data)
end

function SuperRankController:listEvent()
    return {}
end


function SuperRankController:openView(data)
    if nil == self._view then
        self._view = SuperRankView.new(app.mvc.VIEWTYPE_BLUR)
        self._view:onCloseView(handler(self, self.closeView))
        self._view:onClearView(handler(self, self.clearView))
        self._view:onOperate(handler(self, self.onOperate))
    end
    self:addChild(self._view, data)
    
    self._view:openByKey(data)
    self._view:show()
end
function SuperRankController:closeView(data)
    if self._view then
        self:removeChild(self._view, data)
        self:clearView()
    end
end
function SuperRankController:clearView()
    if self._view then
        self._view = nil
    end
end


function SuperRankController:popGuildDetailView(data)
    local NewRankGuildDetailView = require("app.newRank.views.NewRankGuildDetailView")
    local view = NewRankGuildDetailView.new(nil, data)
    view:onCloseView(function(sender)
        UIHandler:removePopupUiByKey(sender:getViewName())
    end)
    UIHandler:addPopupUi(view, view:getViewName())
    view:show()
end

-------------------------------------------------------


-------------------------------------------------------
-- function SuperRankController:onOperate(op, data)
--     print("SuperrankController:onOperate op = " .. op)
--     if op == "" then
--     end
-- end

return SuperRankController
